import sys
import jieba

text_in = sys.argv[1]
text_out = sys.argv[2]

with open(text_in, 'r', encoding='utf-8') as tr:
    with open(text_out, 'w', encoding='utf-8') as tw:
        for line in tr:
            parts = line.strip().split()
            uttid = parts[0]
            sentence = ''.join(parts[1:])
            words = jieba.cut(sentence)
            tw.write(uttid+' '+' '.join(words)+'\n')

print('Done!')
